package com.imooc.common.result;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @ClassName: ResponseData
 * @Description:
 * @author: limingxing
 * @Date: 2019-12-23 16:23
 */
@Data
@ApiModel(value = "自定义响应数据结构")
public class ResponseData<T> {

    private boolean success;
    @ApiModelProperty(value = "响应消息")
    private String msg;

    @ApiModelProperty(value = "响应业务状态")
    private Integer status;

    @ApiModelProperty(value = "响应中的数据")
    private T data;

    @JsonIgnore
    private String ok;	// 不使用


    public ResponseData() {}

    public ResponseData(T data) {
        this.status = 200;
        this.msg = "OK";
        this.data = data;
    }

    public ResponseData(Integer status, String msg, T data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public ResponseData(Integer status, String msg, T data, String ok) {
        this.status = status;
        this.msg = msg;
        this.data = data;
        this.ok = ok;
    }

}
